package edu.gyc.objecthomework; /**
 *
 * File name: Bullseye.java
 *
 * This program uses the drawCircle method to draw concentric
 * circles of alternating colors.
 *
 * Written by: Brian Durney, Kenrick Mock
 * Date: June 28 2017
 *
 */

import javafx.application.Application;
import javafx.scene.canvas.Canvas;
import javafx.scene.Scene;
import javafx.scene.Group;
import javafx.stage.Stage;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.shape.ArcType;
import javafx.scene.paint.Color;

public class Bullseye extends Application
{
	public static void main(String[] args)
	{
      launch(args);
	}

	private void drawCircle(GraphicsContext gc, int centerX,
            int centerY, int diameter, Color color)
	{
        gc.setFill(color);
        gc.fillOval(centerX - diameter / 2, centerY - diameter / 2,
           	        diameter, diameter);
    }

	@Override
	public void start(Stage primaryStage) throws Exception
	{
		Group root = new Group();
		Scene scene = new Scene(root);

		Canvas canvas = new Canvas(300, 300);
		GraphicsContext gc = canvas.getGraphicsContext2D();

        drawCircle(gc, 100, 100, 175, Color.GREEN);
        drawCircle(gc, 100, 100, 150, Color.BLUE);
        drawCircle(gc, 100, 100, 125, Color.GREEN);
        drawCircle(gc, 100, 100, 100, Color.BLUE);
        drawCircle(gc, 100, 100, 75, Color.GREEN);
        drawCircle(gc, 100, 100, 50, Color.BLUE);

		root.getChildren().add(canvas);
		primaryStage.setTitle("Bullseye in JavaFX");
		primaryStage.setScene(scene);
		primaryStage.show();
    }
}
